﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GestionaleLib.Controller;
using GestionaleLib;

namespace Leaf.View.Vendita
{
    public partial class frmElencoVendite : Form
    {
        public frmElencoVendite()
        {
            InitializeComponent();
            Elenco();
        }

        private void FormattaGriglia()
        {
            if (Grid.Rows.Count > 0)
                Grid.Columns["Id"].Visible = false;
            //Grid.Columns["IdTessera"].Visible = true;
        }

        private void CaricaTipoDoc()
        {
            ctrlTipoDocumenti TipoDoc = new ctrlTipoDocumenti();
            
        }
        private void Elenco()
        {
            int Progressivo;

            List<Documento> Lista = new List<Documento>();
            Grid.ColumnCount = 5;
            Grid.Columns[0].Name = "Progressivo";
            Grid.Columns[1].Name = "Documento";
            Grid.Columns[2].Name = "Data Emissione";
            Grid.Columns[3].Name = "Data Scadenza";
            Grid.Columns[4].Name = "Prezzo";
            //Grid.Columns[5].Name = "Sconto";

            Lista = new ctrlDocumenti().Documenti();
            for (int i = 0; i < Lista.Count; i++)
            {
                Progressivo = Lista[i].ProgressivoDoc;
                //Grid.Rows[i].Cells[0].Value = "Pippo";
                //Grid.Rows[i].Cells["Documento"].Value = Lista[0].Protocollo.Nome;
                //Grid.Rows[i].Cells["Data Emissione"].Value = Lista[0].DataEmissione;
                //Grid.Rows[i].Cells["Data Scadenza"].Value = Lista[0].DataScadenza;
                //Grid.Rows[i].Cells["Prezzo"].Value = Lista[i].Dettagli[0].Piede.TotaleDaPagare;

                string[] row = new string[] { Convert.ToString(Progressivo), Lista[i].TipoDoc, Convert.ToString(Lista[i].DataEmissione), Convert.ToString(Lista[i].DataScadenza) };
                Grid.Rows.Add(row);
            }
            //Grid.DataSource = null;
            //Grid.DataSource = Lista;
            
            //FormattaGriglia();
        }

        private void frmElencoVendite_Load(object sender, EventArgs e)
        {
            //Elenco();
        }

    }
}
